//
//  MateReportPopView.m
//  TQY
//
//  Created by 甘世清 on 2024/10/2.
//

#import "MateReportPopView.h"
#import "ReportMatePopView.h"
@implementation MateReportPopView

- (void)SQ_UIViewForSelfView{
    self.backgroundColor = UIColor.whiteColor;
    self.layer.cornerRadius = 30;
    [self addSubview:self.addBtn];
    [self.addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self).offset(30);
        make.width.mas_equalTo(SCREEN_WIDETH - 40);
        make.height.mas_equalTo(54);
    }];
    
    UIView * lineView1 = [[UIView alloc]init];
    lineView1.backgroundColor = SQColorF5F5F5;
    [self addSubview:lineView1];
    [lineView1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self);
            make.height.mas_equalTo(2);
            make.bottom.equalTo(self.addBtn.mas_bottom).offset(14);
    }];
    [self addSubview:self.pingbiBtn];
    [self.pingbiBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.addBtn.mas_bottom).offset(30);
        make.width.mas_equalTo(SCREEN_WIDETH - 40);
        make.height.mas_equalTo(54);
    }];
    UIView * lineView = [[UIView alloc]init];
    lineView.backgroundColor = SQColorF5F5F5;
    [self addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self);
            make.height.mas_equalTo(10);
            make.bottom.equalTo(self.mas_bottom).offset(-FootHeight-60);
    }];
    
    [self addSubview:self.moreBtn];
    [self.moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.width.mas_equalTo(SCREEN_WIDETH - 40);
        make.bottom.equalTo(self.mas_bottom).offset(-10-FootHeight);
        make.height.mas_equalTo(44);
    }];
    WS(weakSelf);
    [self.pingbiBtn setTouchBlock:^(SQCustomButton * _Nonnull button) {
        if ([weakSelf.type isEqualToString:@"1"]) {
            [weakSelf SQ_blackButtonClick];
        } else {
            [weakSelf SQ_PingBiButtonClick];
        }
    }];
    [self.addBtn setTouchBlock:^(SQCustomButton * _Nonnull button) {
        [weakSelf SQ_reportPopView];
    }];
    
}
- (void)setModel:(MateModel *)model{
    _model = model;
}
-(void)SQ_blackButtonClick{
    WS(weakSelf);
    NSMutableDictionary * dic = [[NSMutableDictionary alloc]init];
    [dic setObject:self.model.uid forKey:@"pid"];
    [dic setObject:@"1" forKey:@"type"];
    [HttpTool post:@"blacklist/save" paramDic:dic successBlock:^(BaseModel * _Nonnull httpModel) {
        [YJProgressHUD showMsgWithoutView:SQNSLocalString(@"拉黑成功")];
        if (weakSelf.hideMatetouchBlock) {
            weakSelf.hideMatetouchBlock();
        }
    } andFailBloc:^(BaseModel * _Nonnull httpModel, NSError * _Nullable error) {
        [YJProgressHUD showMsgWithoutView:httpModel.message];
    }];
}
-(void)SQ_PingBiButtonClick{
    WS(weakSelf);
    NSMutableDictionary * dic = [[NSMutableDictionary alloc]init];
    [dic setObject:self.model.userid forKey:@"id"];
    [HttpTool post:@"lug/hide" paramDic:dic successBlock:^(BaseModel * _Nonnull httpModel) {
        [YJProgressHUD showMsgWithoutView:SQNSLocalString(@"屏蔽成功")];
        if (weakSelf.hideMatetouchBlock) {
            weakSelf.hideMatetouchBlock();
        }
    } andFailBloc:^(BaseModel * _Nonnull httpModel, NSError * _Nullable error) {
        [YJProgressHUD showMsgWithoutView:httpModel.message];
    }];
}
-(void)SQ_reportPopView{
    ReportMatePopView * vc = [[ReportMatePopView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDETH, SCREEN_HEIGHT-200)];
    vc.uid = self.model.uid;
    LSTPopView * pop = [LSTPopView initWithCustomView:vc
                                             parentView:nil
                                               popStyle:LSTPopStyleSmoothFromBottom dismissStyle:LSTDismissStyleSmoothToBottom];
    pop.hemStyle = LSTHemStyleBottom;
    pop.isStack = YES;
    [pop pop];
    LSTPopViewWK(pop)
    [pop setBgClickBlock:^{
        [wk_pop dismiss];
    }];
    [vc setReportMatetouchBlock:^{
        [wk_pop dismiss];
    }];
}
- (void)setType:(NSString *)type{
    _type = type;
    self.pingbiBtn.text = SQNSLocalString(@"拉黑");
}

- (SQCustomButton *)moreBtn{
    if (!_moreBtn) {
        _moreBtn = [[SQCustomButton alloc]initType:SQCustomButtonTopImageType imageSize:CGSizeMake(0, 0) midmargin:0];
        _moreBtn.text = SQNSLocalString(@"取消");
        _moreBtn.textColor = SQColor666666;
        _moreBtn.font = FONT_REGULAR(14);
    }
    return _moreBtn;
}


- (SQCustomButton *)addBtn{
    if (!_addBtn) {
        _addBtn = [[SQCustomButton alloc]initType:SQCustomButtonTopImageType imageSize:CGSizeMake(0, 0) midmargin:0];
        _addBtn.text = SQNSLocalString(@"举报");
        _addBtn.textColor = SQColor3DA59D;
        _addBtn.font = FONT_REGULAR(14);
        
    }
    return _addBtn;
}
- (SQCustomButton *)pingbiBtn{
    if (!_pingbiBtn) {
        _pingbiBtn = [[SQCustomButton alloc]initType:SQCustomButtonTopImageType imageSize:CGSizeMake(0, 0) midmargin:0];
        _pingbiBtn.text = SQNSLocalString(@"屏蔽");
        _pingbiBtn.textColor = SQColor3DA59D;
        _pingbiBtn.font = FONT_REGULAR(14);
        
    }
    return _pingbiBtn;
}

@end
